﻿/**
 ** @作者:	   王桂龙 QQ731513122
 ** @日期:	   2019.12.6
 ** @简介:     CheckBox      
 */
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace BHXJDOTNET.OLD
{
    public class BHXJCheckBox:CheckBox,IBHXJZOOM
    {
        #region 继承于ZOOM接口的属性和方法
        private Point _OriginPoint = new Point(0, 0);
        [Description("原点(慎用,在足够了解BHXJZoom的情况下使用)"), Category("BHXJZoom")]
        /// <summary>
        /// 原点
        /// </summary>
        public Point OriginPoint
        {
            get
            { return this._OriginPoint; }
            set
            {
                if (this._OriginPoint != value)
                {
                    this._OriginPoint = value;
                    if (DesignMode)
                        this.IniLocation = this.BHXJGetIniLocationInDesignMode();
                }
            }
        }
        private bool _AutoOrigin = false;
        [Description("自动更改原点模式(只在设计模式下有用)"), Category("BHXJZoom")]
        /// <summary>
        /// 自动更改原点模式(只在设计模式下有用)
        /// </summary>
        public bool AutoOrigin
        {
            get
            {
                return this._AutoOrigin;
            }
            set
            {
                if (this._AutoOrigin != value)
                {
                    this._AutoOrigin = value;
                    if (DesignMode)
                    {
                        if (this.AutoOrigin)
                        {
                            this.OriginPoint = this.Location;
                        }
                        else
                        {
                            this.OriginPoint = new Point(0, 0);
                        }
                    }
                }
            }
        }
        /// <summary>
        /// 初始尺寸
        /// </summary>
        [Browsable(false)]
        public Size IniSize { get; set; }
        /// <summary>
        /// 初始位置
        /// </summary>
        [Browsable(false)]
        public Point IniLocation { get; set; }
        /// <summary>
        /// 初始字体
        /// </summary>
        [Browsable(false)]
        public Font IniFont { get; set; }

        #endregion

        public BHXJCheckBox()
        {
            #region 设计时,变化事件
            if (System.ComponentModel.LicenseManager.UsageMode == System.ComponentModel.LicenseUsageMode.Designtime)
            {
                //设计时事件
                this.SizeChanged += new EventHandler(this.BHXJ_SizeChangedInDesignMode);
                this.FontChanged += new EventHandler(this.BHXJ_FontChangedInDesignMode);
                this.LocationChanged += new EventHandler(this.BHXJ_LocationChangedInDesignMode);
            }
            #endregion

            //防止字体在设计器中添加该控件时候自动追随父控件
            this.Font = this.Font;

            //设置初始
            this.IniSize = this.Size;
            this.IniFont = this.Font;
            this.IniLocation = this.BHXJGetIniLocationInDesignMode();

            this.ForeColor = Color.LimeGreen;
        }
    }
}
